<?php

class Channel extends Module
{

	function __construct ($db){
		$this->set_db($db);
	}

	function get_all_channel(){
		$result = $this->get_all("channel", 1, "ORDER by id DESC");

		foreach($result as $k => $v){
			$youtube = new Youtube();
			$youtube->load($v['url']);
			$result[$k]['image'] = $youtube->getImage();
		}

		return $result;
	}

	function get_channel($id){
		$result = $this->get("channel", "id=$id");

		$youtube = new Youtube();
		$youtube->load($result['url']);

		$result['yid'] = $youtube->getYoutubeID();
		$result['image'] = $youtube->getImage();

		return $result;
	}

	function get_max_channel(){
		return $this->db->maxOf("id","channel",1);
	}
}

?>